
export enum ResponseStatus {
  Succ = 0,
  Fail = 1
}

export default class CommonResponse {

  static response(status: number, msg?: string, data?: any) {
    return {
      status,
      msg,
      data
    }
  }

  static succ(data?: any, msg: string = 'success') {
    return {
      status: ResponseStatus.Succ,
      msg,
      data
    }
  }

  static fail(msg: string = '', data?: any) {
    return {
      status: ResponseStatus.Fail,
      msg,
      data
    }
  }

  static tableRutSucc(rut: Array<any>, msg?: string) {
    return {
      code: 0,
      message: msg,
      type: 'success',
      result: {
        items: rut,
        total: rut.length
      }
    }
  }
}